import xlrd
import os

#文件路径
def read_excel(file_name, sheet_name, index=0) -> list[tuple]:
    bath_path=os.path.dirname(os.path.dirname(__file__))
    file_path=bath_path + "/data/" + file_name
    file=xlrd.open_workbook(file_path)
    book=file.sheet_by_name(sheet_name)
    list1=[]
    # for nrow in range(index, book.nrows):  # 遍历行数
    #     # 把每一行的数据变成元组追到list1里面，
    #     list1.append(tuple(book.row_values(nrow)))
    # return list1
    for i in range(index,book.nrows):
        list1.append(tuple(book.row_values(i)))
    return list1




# read_excel("data.xls","register_data",1)